﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace det
{
    public partial class frm_Login : DevComponents.DotNetBar.Office2007Form
    {
        Xuly dn = new Xuly();
        Chuoiketnoi kn = new Chuoiketnoi();
        public frm_Login()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (dn.ktdangnhap(txtUser.Text, txtPass.Text) == true)
            {
                Form1.user = txtUser.Text;
                Form1 f = (Form1)this.MdiParent;
                //lblTest.Text = kn.phanquyen(txtUser.Text);
                if (kn.phanquyen(txtUser.Text) == "Admin")
                {
                    f.admin();
                }
                else
                {
                    f.nhanvien();
                }
                MessageBox.Show("Welcome!");
                this.Close();
            }
            else
            {
                MessageBox.Show("Sai thông tin đăng nhập!");
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
